import React from 'react'
import { Button, Form, Input, Modal } from 'antd'

function FormAlert({title, open, closefn, formSubmit, form}) {
    const onCancel = () => {
        closefn()
    }
    const onFinish = (values) => {
        formSubmit(values)
    }
  return (
    <Modal 
        title={title}
        open={open} 
        onCancel={onCancel}
        footer={null}
    >
      <Form onFinish={onFinish} form={form}>
        <Form.Item name="id" hidden>
            <Input /> 
        </Form.Item>
        <Form.Item name="name" rules={[
            {required: true, message: '请输入名称'}
        ]}>
            <Input /> 
        </Form.Item>
        <Form.Item name="job" rules={[
            {required: true, message: '请输入名称'}
        ]}>
            <Input /> 
        </Form.Item>
        <Form.Item>
            <Button htmlType='submit'>提交</Button> 
        </Form.Item>
      </Form>
    </Modal>
  )
}

export default FormAlert
